package com.sina.shop.service.goods;

import com.sina.shop.domain.goods.Goods;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * Description: 调用服务，并配置断路器，当调用出错时调用默认的配置。
 * 段浩杰   2018-01-31-17:40
 */
@FeignClient(value = "SHOP-SPRING-CLOUD-ALL", fallback = GoodsServiceBack.class)
public interface GoodsService {

    @RequestMapping(value = "/goods/updateGoods", method = RequestMethod.POST)
    Goods updateGoods(@RequestBody(required = false) Goods goods);

    @RequestMapping(value = "/goods/getGoods", method = RequestMethod.GET)
    Goods getGoods(@RequestParam("id") Long id);

    @RequestMapping(value = "/goods/getGoodsList", method = RequestMethod.GET)
    Map<String, Object> getGoodsList(@RequestBody(required = false) Goods goods);

    @RequestMapping(value = "/goods/saveGoods", method = RequestMethod.POST)
    Goods saveGoods(@RequestBody(required = false) Goods goods);

    @RequestMapping(value = "/goods/deleteGoods", method = RequestMethod.POST)
    Integer deleteGoods(@RequestParam("id") Long id);

}
